#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QDebug>
#include <QSqlDatabase>
#include <vector>
#include<QStandardItemModel>
#include "parts.hpp"
#include "QSqlQuery"
#include "OpenXLSX.hpp"
namespace ox = OpenXLSX;


QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE


class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

public slots:
    void slot_select_xlsx();

private:
    bool open_doc(std::string fn);
    bool parse_doc();
    void set_tabel_view();
    void db_add_part(const PARTS &part);
    Ui::MainWindow *ui;
    ox::XLDocument doc;
    // QSqlQuery query;
    std::vector<PARTS> parts;
    QSqlDatabase db;

    QStandardItemModel *model_list;
    int list_line;
};
#endif // MAINWINDOW_H
